package ioexercise;

import java.io.*;

public class CopyDemo3Buffered {
    //缓冲流实现文件的复制--------CopyDemo3Buffered
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("1.jpg");
        BufferedInputStream bis=new BufferedInputStream(fis);
        FileOutputStream fos=new FileOutputStream("1_copy.png");
        BufferedOutputStream bos=new BufferedOutputStream(fos);
        int a;
        long start=System.currentTimeMillis();
       while ((a=bis.read())!=-1){
           bos.write(a);
       }
       bis.close();
       bos.close();
       long ends=System.currentTimeMillis();
        System.out.println("复制完毕！耗时"+(ends-start)+"ms");

    }



}
